﻿@using BootstrapBlazor.Components
@using BlazorAdmin.Generator.Generators
@using Console = BootstrapBlazor.Components.Console

<style>
    .generator {
        --bb-row-label-width: 160px;
    }
</style>
<Card IsCenter="true">
    <HeaderTemplate>代码生成器，可根据指定数据源生成PetaPoco + Razor风格的代码</HeaderTemplate>
    <BodyTemplate>
        <ValidateForm Model="Setting" OnValidSubmit="GenerateCode">
            <div class="row g-3 form-inline generator">
                <div class="col-sm-6 col-md-6">
                    <Select Items="ProviderItems" @bind-Value="Setting.ProviderName" ShowLabel="true" />
                </div>
                <div class="col-sm-6 col-md-6">
                    <BootstrapInput @bind-Value="Setting.ConnectionString" PlaceHolder="默认（当前系统环境）" ShowLabel="true" />
                </div>
                <div class="col-sm-12 col-md-12">
                    <Textarea @bind-Value="Setting.GenTableNames" rows="3" PlaceHolder="多个表名用逗号隔开" ShowLabel="true" />
                </div>
                <div class="col-sm-6 col-md-6">
                    <Select Items="StyleItems" @bind-Value="Setting.CodeStyle" ShowLabel="true" />
                </div>
                <div class="col-sm-6 col-md-6">
                    <BootstrapInput @bind-Value="Setting.RootPath" OnValueChanged=OnRootPathChanged PlaceHolder="应用简称" ShowLabel="true" />
                </div>
                <div class="col-sm-6 col-md-6">
                    <BootstrapInput @bind-Value="Setting.EntityPath" PlaceHolder="实体目录" ShowLabel="true" />
                </div>
                <div class="col-sm-6 col-md-6">
                    <BootstrapInput @bind-Value="Setting.InterfacePath" PlaceHolder="接口目录" ShowLabel="true" />
                </div>
                <div class="col-sm-6 col-md-6">
                    <BootstrapInput @bind-Value="Setting.ServicePath" PlaceHolder="服务目录" ShowLabel="true" />
                </div>
                <div class="col-sm-6 col-md-6">
                    <BootstrapInput @bind-Value="Setting.RazorComponentPath" PlaceHolder="Razor组件目录" ShowLabel="true" />
                </div>
                <div class="col-sm-6 col-md-6">
                    <BootstrapInput @bind-Value="Setting.RazorModelPath" ShowLabel="true" PlaceHolder="Razor模型目录" />
                </div>
                <div class="col-sm-6 col-md-6">
                    <BootstrapInput @bind-Value="Setting.RazorPagePath" ShowLabel="true" PlaceHolder="Razor页面目录" />
                </div>
                <div class="col-sm-12 col-md-12">
                    <Console Items="Messages" IsAutoScroll="true" Height="250">
                        <HeaderTemplate>
                            <div style="width: 100%; text-align: center;">
                                <Button Text=" 生 成 代 码 " ButtonType="ButtonType.Submit" Color="Color.Primary" Size="Size.Medium" Icon="fas fa-terminal" />
                            </div>
                        </HeaderTemplate>
                    </Console>
                </div>
            </div>
        </ValidateForm>
    </BodyTemplate>
</Card>